#include <sstream>
#include<bits/stdc++.h>
#include <ctime>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>pbds; // *variable.find_by_order(value) => will give value at that index
typedef tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>pbdsgreater; // variable.order_of_key(value) => total no of element less than value
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>pbdsmultiset; // *variable.lower_bound(value) , *variable.upper_bound(value)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define db long double
#define minpqint priority_queue<int, vector<int>, greater<int>>
#define minpqpi priority_queue<pi,vpi,greater<pi>>
#define maxpqint priority_queue<int>
#define maxpqpi priority_queue<pi>
#ifndef ONLINE_JUDGE
#define debug(x) cerr<<#x<<" ";_print(x); cerr<<endl;
#else
#define debug(x)
#endif
void _print(int a){cerr<<a;}
void _print(char a){cerr<<a;}
void _print(string a){cerr<<a;}
void _print(bool a){cerr<<a;}
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";}
template<class T> void _print(vector<T> v){cerr<<"[";for(T i:v){_print(i);cerr<<" ";}cerr<<"]";}
template<class T> void _print(set<T> s){cerr<<"[";for(T i:s){_print(i);cerr<<" ";}cerr<<"]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
int dx4[] = {-1,0,1,0};
int dy4[] = {0,1,0,-1};
// int dx4[] = {0, 1, 0, -1};// acc to question west->south->east->north
// int dy4[] = {-1, 0, 1, 0};// acc to question west->south->east->north
// int change[] = {2,3,0,1};// acc to question west->south->east->north
int dx8[] = {-1,-1,0,1,1,1,0,-1};
int dy8[] = {0,1,1,1,0,-1,-1,-1};
string dir = "URDL";
const int mod = 1e9+7;;
const int modl = 1e18;
const int inf = 1e9+7;
const int infn = -1e9+7;
int mod_add(int a, int b, int m) {a = a % m; b = b % m; return (((a + b) % m) + m) % m;}
int mod_mul(int a, int b, int m) {a = a % m; b = b % m; return (((a * b) % m) + m) % m;}
int mod_sub(int a, int b, int m) {a = a % m; b = b % m; return (((a - b) % m) + m) % m;}
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);}
int power(int base,int n,int mod) {int ans = 1; while(n>0){if(n%2==0){n/=2;base = mod_mul(base,base,mod);}else{ans = mod_mul(ans,base,mod); n--;}} return ans;}
signed main()
{
fio;
#ifndef ONLINE_JUDGE
freopen("Error.txt","w",stderr);
freopen("output.txt", "w", stdout);
freopen("input.txt", "r", stdin);
#endif
// try to use map,set instead of unordered_map,set in cf....
srand(time(NULL));
int t;
cin>>t;
while(t--){
int n,q;
cin>>n>>q;
vector<int>v(n+1);
for(int i=1;i<=n;i++){
cin>>v[i];
}
int iq = 0;
vector<int>ans(n+1);
for(int i=n;i>=1;i--){
if(v[i]<=iq)ans[i] = 1;
else if(v[i]>iq && iq<q){
ans[i] = 1;
iq++;
}
else{
ans[i] = 0;
}
}
for(int i=1;i<=n;i++){
cout<<ans[i];
}
cout<<endl;
}
return 0;
}
1665C - Tree Infection | 1665D - GCD Guess |
29A - Spit Problem | 1097B - Petr and a Combination Lock |
92A - Chips | 1665B - Array Cloning Technique |
1665A - GCD vs LCM | 118D - Caesar's Legions |
1598A - Computer Game | 1605A - AM Deviation |
1461A - String Generation | 1585B - Array Eversion |
1661C - Water the Trees | 1459A - Red-Blue Shuffle |
1661B - Getting Zero | 1661A - Array Balancing |
1649B - Game of Ball Passing | 572A - Arrays |
1455A - Strange Functions | 1566B - MIN-MEX Cut |
678C - Joty and Chocolate | 1352E - Special Elements |
1520E - Arranging The Sheep | 1157E - Minimum Array |
1661D - Progressions Covering | 262A - Roma and Lucky Numbers |
1634B - Fortune Telling | 1358A - Park Lighting |
253C - Text Editor | 365B - The Fibonacci Segment |